package com.huawei.appgallery.foundation.ui.css;

import android.text.TextUtils;
import java.util.List;
import java.util.Locale;

public class CSSSelector {
    private List<String> selectArray;
    private String selectorText;

    private CSSSelector() {
    }

    public CSSSelector(String str) {
        if (str != null) {
            this.selectorText = str.toLowerCase(Locale.US);
        }
    }

    private static CSSRule getRule(String str, CSSRule cSSRule) {
        if (str == null || cSSRule == null) {
            return null;
        }
        for (CSSRule cSSRule2 : cSSRule.getChildCssRule()) {
            if (TextUtils.equals(cSSRule2.getSelectorText(), str)) {
                return cSSRule2;
            }
        }
        return null;
    }

    public CSSSelector select(String str) {
        return new Builder(this).select(str).build();
    }

    public CSSRule getRule(CSSRule cSSRule) {
        return getRule(this.selectorText, cSSRule);
    }
}
